package com.alvin.mbp.entity;

import java.util.Date;
import java.util.Map;

import org.junit.Test;

import com.alvin.mbp.util.JDBCName;

@JDBCName("t_record")
public class PointRecord extends BaseEntity {

	private PointMember member;
	private Integer memberId;

	private Double balance;

	private PointRule rule;
	private Integer ruleId;

	private Date recordTime;

	private Integer type;

	private Double point;

	private String iCode;

	private String oper;

	public Map<String, Object> getEntityMap() {
		Map<String, Object> map = super.getEntityMap();
		map.put("member_id", memberId);
		map.put("balance", balance);
		map.put("rule_id", ruleId);
		map.put("record_time", recordTime);
		map.put("type", type);
		map.put("point", point);
		map.put("i_code", iCode);
		map.put("oper", oper);
		return map;
	}

	public Double getPoint() {
		return point;
	}

	public void setPoint(Double point) {
		this.point = point;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public PointMember getMember() {
		return member;
	}

	public void setMember(PointMember member) {
		this.member = member;
	}

	public Double getBalance() {
		return balance;
	}

	public void setBalance(Double balance) {
		this.balance = balance;
	}

	public PointRule getRule() {
		return rule;
	}

	public void setRule(PointRule rule) {
		this.rule = rule;
	}

	public Date getRecordTime() {
		return recordTime;
	}

	public void setRecordTime(Date recordTime) {
		this.recordTime = recordTime;
	}

	public String getiCode() {
		return iCode;
	}

	public void setiCode(String iCode) {
		this.iCode = iCode;
	}

	public String getOper() {
		return oper;
	}

	public void setOper(String oper) {
		this.oper = oper;
	}

	public Integer getMemberId() {
		return memberId;
	}

	public void setMemberId(Integer memberId) {
		this.memberId = memberId;
	}

	public PointType getPointType() {
		for (PointType t : PointType.values()) {
			if (t.ordinal() == type) {
				return t;
			}
		}
		return null;
	}

	@Test
	public void testName() {
		System.out.println(PointRecord.class.getAnnotation(JDBCName.class).value());
	}
}
